package com.syy.group;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class OrderBeanMapper extends Mapper<LongWritable, Text, OrderBean, NullWritable> {
    private OrderBean orderBean = new OrderBean();
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String s = value.toString();
        String[] split = s.split("\t");

        orderBean.setOrderId(split[0]);
        orderBean.setpId(split[1]);
        orderBean.setPrice(Double.parseDouble(split[2]));

        context.write(orderBean, NullWritable.get());
    }
}
